<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      * {
        margin: 0;
        padding: 0;
      }

      .box1 {
        width: 100px;
        height: 100px;
        background-color: pink;
        display: none;
      }

      .box2 {
        width: 100px;
        height: 100px;
        background-color: hotpink;
        opacity: 0;
      }

      .box3 {
        width: 100px;
        height: 100px;
        background-color: deeppink;
        visibility: hidden;
      }

      .box4 {
        width: 100px;
        height: 100px;
        background-color: lightpink;
      }
    </style>
  </head>
  <body>
    <!-- 
      1. display: none 不占位。不会响应 DOM 事件。 
      2. opacity: 0 占位，但不可见。会响应 DOM 事件。 
      3. visibility: hidden 占位，但不可见。不会响应 DOM 事件。 
      4. transform: scale(0)
      5. transform: rotateY(90deg)
      6. 定位到屏幕外
      7. 定位到父元素外，父元素overflow: hidden
    -->

    <div class="box1">111</div>
    <div class="box2">222</div>
    <div class="box3">333</div>
    <div class="box4">444</div>

    <script>
      document.querySelector(".box1").onclick = function () {
        console.log(111);
      };

      document.querySelector(".box2").onclick = function () {
        console.log(222);
      };

      document.querySelector(".box3").onclick = function () {
        console.log(333);
      };
    </script>
  </body>
</html>
